/**
 * Copyright (C) 2013 The yydorid-framework project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.yangying.androidframework.util;


import android.content.Context;
import android.util.Log;
import android.widget.Toast;

import java.io.IOException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import net.yangying.androidframework.R;

public class NotificationsUtil {
    private static final String TAG = "NotificationsUtil";

    public static void ToastReasonForFailure(Context context, Exception e) {
        	Log.d(TAG, "Toasting for exception: ", e);

//        if (e == null) {
//            Toast.makeText(context, context.getString(R.string.exception_network_error),
//                    Toast.LENGTH_SHORT).show();
//        } else if (e instanceof SocketTimeoutException) {
//            Toast.makeText(context, context.getString(R.string.exception_timeout), Toast.LENGTH_SHORT).show();
//            
//        } else if (e instanceof SocketException) {
//            Toast.makeText(context, context.getString(R.string.exception_socket), Toast.LENGTH_SHORT).show();
//
//        } else if (e instanceof IOException) {
//            Toast.makeText(context, context.getString(R.string.exception_network_unavailable), Toast.LENGTH_SHORT).show();
//
//        } 
//        else if (e instanceof MB2BException) {
//            String message;
//            int toastLength = Toast.LENGTH_SHORT;
//            if (e.getMessage() == null) {
//                message = "Invalid Request";
//            } else {
//                message = e.getMessage();
//                toastLength = Toast.LENGTH_LONG;
//            }
//            Toast.makeText(context, message, toastLength).show();
//
//        } 
//        else 
//        {
//            Toast.makeText(context, context.getString(R.string.exception_network_error),
//                    Toast.LENGTH_SHORT).show();
//        }
    }
}
